package com.example.kemusan.controller;

import com.example.kemusan.pojo.Result;
import com.example.kemusan.pojo.SystemuserInfo;
import com.example.kemusan.pojo.dto.NewPassword;
import com.example.kemusan.service.SystemuserInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@Slf4j
@RequestMapping("/user")
public class SystemuserInfoController {

    @Autowired
    private SystemuserInfoService systemuserInfoService;

    /**
     * 登录
     * @param systemuserInfo
     * @return
     */
    @PostMapping("/login")
    public Result login(@RequestBody SystemuserInfo systemuserInfo){
        return systemuserInfoService.login(systemuserInfo);
    }

    /**
     * 修改密码
     * @param newPassword
     * @return
     */
    @PostMapping("/setNewPassword")
    public Result setNewPassword(@RequestBody NewPassword newPassword){
        return systemuserInfoService.setNewPassword(newPassword);
    }

}
